#include <iostream>
using namespace std;

void reverse(char *str)
{
    char *end = str;
    char temp;
    if (str)
    {
        while (*end != '\0')
        {
            ++end;
        }
        --end;
        while (str < end)
        {
            temp = *str;
            *str++ = *end;
            *end-- = temp;
        }
    }
}

int main()
{
    char str[] = "123123123";
    cout << str << endl;
    reverse(str);
    cout << str << endl;
}